package org.jsola.hr.service.impl;

import org.jsola.admin.constant.CustomTemplateSubjectType;
import org.jsola.admin.service.ISubjectService;
import org.jsola.exception.ParamException;
import org.jsola.hr.provider.IRecruit2ProviderService;
import org.jsola.recruit2.entity.RecruitInfoDO;
import org.jsola.recruit2.service.IRecruitInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 各个业务实现admin方法
 *
 * @author Mr.Zheng
 */
@Service("hrSubjectServiceImpl")
public class SubjectServiceImpl implements ISubjectService {

    @Autowired
    private IRecruit2ProviderService recruit2ProviderService;

    @Override
    public String getSiteIdBySubjectTypeAndId(String subjectType, String subjectId) {

        // 类型为岗位的查询岗位表
        if (CustomTemplateSubjectType.RECRUIT.getValue().equals(subjectType)) {
            RecruitInfoDO recruitInfoDO = recruit2ProviderService.selectRecruitInfoByIdNotSiteId(subjectId);
            ParamException.notNull(recruitInfoDO, "岗位信息不存在，请刷新后再试");
            return recruitInfoDO.getSiteId();
        }

        return null;
    }

}
